package dr.member.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import dr.controller.Action;
import dr.member.dao.MemberDAO;
import dr.member.domain.Member;
public class ModifyProAction implements Action {

	@Override
	public String execute(HttpServletRequest request,
			HttpServletResponse response) throws Throwable {
		
		request.setCharacterEncoding("euc-kr");
		
		//login check
		HttpSession session=request.getSession();
		String id=(String)session.getAttribute("memId");
		if(id==null){
			return "/member/loginForm.jsp";
		}
		//login check
		Member member=new Member();
		member.setId(request.getParameter("id"));
		System.out.println(request.getParameter("id"));
		member.setName(request.getParameter("name"));
		System.out.println(request.getParameter("name"));
		member.setPhone(request.getParameter("phone1")+"-"+request.getParameter("phone2")+"-"+request.getParameter("phone3"));	
		System.out.println(member.getPhone());
		member.setZip(request.getParameter("zip"));
		System.out.println(request.getParameter("zip"));
		member.setAddr1(request.getParameter("addr1"));
		System.out.println(request.getParameter("addr1"));
		member.setAddr2(request.getParameter("addr2"));	   
		System.out.println(request.getParameter("addr2")); 
		member.setEmail(request.getParameter("email"));
		System.out.println(request.getParameter("email"));
		
		
		MemberDAO manager=MemberDAO.getInstance();
		manager.updateMember(member);
		
		return "/member/modifyPro.jsp";
	}

}
